package 项目管理课程作业;
import java.util.*;

public class SchoolSystem implements ISignUp{
    static int bigNum;
    static int mediumNum;
    static int smallNum;
    ArrayList<String> list=new ArrayList<String>(Collections.singleton("null"));
    public void print(){
        System.out.println(list);
    }

    public boolean addStudent(int stuType) {
		//对大班剩余名额判断确认是否可以录入！
        if(stuType==1){
            if(bigNum>0){
                bigNum--;
                list.add("true");
                return true;
            }
        }
		//对中班剩余名额判断确认是否可以录入
        if(stuType==2){
            if(mediumNum>0){
                mediumNum--;
                list.add("true");
                return true;
            }
        }
		//对小班剩余名额判断确认是否可以录入
        if(stuType==3){
            if (smallNum>0){
                smallNum--;
                list.add("true");
                return true;
            }
        }
        list.add("false");
        return false;
    }
	
    public SchoolSystem(Integer big,Integer medium,Integer small){
        this.bigNum=big;
        this.mediumNum=medium;
        this.smallNum=small;
    }
	//测试案例。
	//输入模板["SchoolSystem", "addStudent", "addStudent", "addStudent", "addStudent"]
	//输入[[1,1,0],[1],[2],[3],[1]]
    public static void main(String[] args) throws Exception{
        IParams params = ISignUp.parse();//SchoolSystem.parse();
        SchoolSystem sc = new SchoolSystem (params.getBig(), params.getMedium(),params.getSmall());
        ArrayList<Integer> plan = params. getPlanSignUp ();
        for(int i=0;i<plan.size();i++){
            sc.addStudent(plan.get(i));
        }
        sc.print();
    }
}
